package com.baidu.bulls.stock.admin.user.repository;

import com.baidu.bulls.stock.entity.user.AuthorityUser;
import com.baidu.bulls.stock.entity.user.QAuthorityRole;
import com.baidu.bulls.stock.entity.user.QAuthorityUser;
import com.querydsl.core.types.dsl.StringExpression;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer;
import org.springframework.data.querydsl.binding.QuerydslBindings;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

/**
 * <p>Description: </p>
 * @date 
 * @author 
 * @version 1.0
 * <p>Copyright:Copyright(c)2020</p>
 */
@RepositoryRestResource(path = "/authorityUser")
public interface AuthorityUserRepository extends PagingAndSortingRepository<AuthorityUser, Long>, JpaSpecificationExecutor<AuthorityUser>,
        QuerydslPredicateExecutor<AuthorityUser>, QuerydslBinderCustomizer<QAuthorityUser> {

    @Override
    default public void customize(QuerydslBindings bindings, QAuthorityUser obj) {

        bindings.bind(obj.userName).first(StringExpression::contains); // 模糊查询
    }


}
